package com.example.role.controller;

import com.example.role.service.RoleService;
import com.wn.common.entity.Const;
import com.wn.common.entity.MyRsp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.management.relation.Role;
import java.util.List;

/**
 * @BelongsProject: shared_parking
 * @BelongsPackage: com.example.role.controller
 * @Author: 段彪
 * @CreateTime: 2020-06-11 10:23
 * @Description: 表现层
 */
@Api(description = "角色API接口")
@RestController
@Slf4j
@RequestMapping("role")
public class RoleController {


    @Autowired
    RoleService roleService;
    //查询所有
    @ApiOperation("查询所有")
    @PostMapping("/getAll")
    public MyRsp getAll(){
        //调用RoleService中的方法
        List<Role> all = roleService.getAll();
        //具体的业务代码，判断
        return MyRsp.success1(Const.Status.STATUS_SUCCESS,"查询成功");
        //状态码根据common
    }

    @ApiOperation("根据主键查询")
    @PostMapping("/getRoleById")
    public MyRsp getRoleById(String rId){
        //如上所视
        System.out.println(rId);
        return MyRsp.success1(Const.Status.STATUS_SUCCESS,"成功");
    }
}
